package com.lm.boot.controller;

import com.lm.boot.dao.UserMapper;
import com.lm.boot.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MyBatisController {

    @Autowired
    private UserMapper userMapper;

    @RequestMapping("/userByid")
    public User getUser(@RequestParam Integer id){

        User u = userMapper.getById(id);
        return u;
    }

    @RequestMapping("/username")
    public User getUser(@RequestParam String username){

        User u = userMapper.getByName(username);
        return u;
    }

    @RequestMapping("/userByPass")
    public User getUserByPass(@RequestParam String password){
        return userMapper.getByPassword(password);
    }
}
